package com.datasure.demo.security;

//import org.springframework.security.core.userdetails.UserDetailsService;
//import org.springframework.stereotype.Component;
//
///**
// * 登陆身份认证
// * @author xiaolong5.zhang
// * @date 2022/04/07 17:47
// **/
//@Component(value="CustomUserDetailsService")
//public class CustomUserDetailsService implements UserDetailsService {
//    private final AuthMapper authMapper;
//
//    public CustomUserDetailsService(AuthMapper authMapper) {
//        this.authMapper = authMapper;
//    }
//
//    @Override
//    public User loadUserByUsername(String name) throws UsernameNotFoundException {
//        User user = authMapper.findByUsername(name);
//        if (user == null) {
//            throw new UsernameNotFoundException(String.format("No user found with username '%s'.", name));
//        }
//        Role role = authMapper.findRoleByUserId(user.getId());
//        user.setRole(role);
//        return user;
//    }
//}
